<?php
  include 'JHeader.php';
  require 'Database/Database.php';

  if(isset($_GET['id']))
  {
      $admin_id   = $_GET['id'];
      if(isset($_GET['name']))
      {
          $admin_name = $_GET['name'];
      }
      else
      {
          $admin_name = 'N/A';
      }

  $db = new Database();
  $db->Connect();
  try
  {
    $deleted = $db->Delete('Admins', 'ID_Admin = ' . $admin_id);
  }
  catch (Exception $ex)
  {
      echo 'Exception: ' . $ex . '<br />';
  }

  $db->Disconnect();
?>
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="css/default.css" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><?php echo $admin_name ?> entfernen</title>
    </head>
    <body>
        <?php
            if($deleted)
            {
                echo $admin_name . ' removed.';
            }
            else
            {
                echo 'Could not remove ' . $admin_name;
            }
        ?>
    </body>
</html>
<?php
}
else
{
    echo 'ERROR';
}
?>